Add specs for icon_for_service.

Akinori MUSHA 10 years ago
parent
commit
fd97a151f9
1 changed files with 26 additions and 0 deletions
  1. 26 0
      spec/helpers/application_helper_spec.rb

+ 26 - 0
spec/helpers/application_helper_spec.rb

@@ -0,0 +1,26 @@
1
+require 'spec_helper'
2
+
3
+describe ApplicationHelper do
4
+  describe '#icon_for_service' do
5
+    it 'returns a correct icon tag for Twitter' do
6
+      icon = icon_for_service(:twitter)
7
+      expect(icon).to be_html_safe
8
+      elem = Nokogiri(icon).at('i.fa.fa-twitter')
9
+      expect(elem).to be_a Nokogiri::XML::Element
10
+    end
11
+
12
+    it 'returns a correct icon tag for GitHub' do
13
+      icon = icon_for_service(:github)
14
+      expect(icon).to be_html_safe
15
+      elem = Nokogiri(icon).at('i.fa.fa-github')
16
+      expect(elem).to be_a Nokogiri::XML::Element
17
+    end
18
+
19
+    it 'returns a correct icon tag for other services' do
20
+      icon = icon_for_service(:'37signals')
21
+      expect(icon).to be_html_safe
22
+      elem = Nokogiri(icon).at('i.fa.fa-lock')
23
+      expect(elem).to be_a Nokogiri::XML::Element
24
+    end
25
+  end
26
+end